<template>
	<view>
		<view class="header">
			<view class="region">
				<my-picker v-model="region" :option="regions" type="text" label-field="name">
					油麻地
				</my-picker>
			</view>
			<view class="search" @click="goSearch">
				<u-input shape="circle" prefix-icon="search" :prefix-icon-style="{'font-size': '36rpx'}"
					:custom-style="{'background-color': '#F2F4F6', height: '36rpx', 'line-height': '72rpx', 'padding-left': '24rpx'}"
					:placeholder="$t('location.placeholder')" @focus="goSearch"></u-input>
			</view>
		</view>
		<view class="location">
			<view class="label">Location</view>
			<view class="con">
				<view class="addr">我的收貨地址我的收貨地址</view>
				<view class="retry">
					{{$t('location.retry')}}
					<u-icon name="reload" size="28" color="#7C8493"></u-icon>
				</view>
			</view>
		</view>
		<view class="divider">{{$t('member.addr.my-addr')}}</view>
		<view class="list">
			<view v-for="(item, index) in addrList" :key="index" class="item">
				<view class="name">{{item.addr}}</view>
				<view class="info">
					<text class="text">{{item.name}}</text>
					<text class="text">{{item.appellation}}</text>
					<text class="text">{{item.phone}}</text>
				</view>
			</view>
		</view>
		<view class="divider">{{$t('member.addr.other-addr')}}</view>
		<view class="list">
			<view v-for="(item, index) in notAddrList" :key="index" class="item">
				<view class="name">{{item.addr}}</view>
				<view class="info">
					<text class="text">{{item.name}}</text>
					<text class="text">{{item.appellation}}</text>
					<text class="text">{{item.phone}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import picker from '@/components/picker.vue'

	export default {
		components: {
			'my-picker': picker
		},
		data() {
			return {
				region: 1,
				regions: [{
						id: 1,
						name: '地区1'
					},
					{
						id: 2,
						name: '地区2'
					}
				],
				addrList: [{
						id: 1,
						addr: '深圳大廈 912',
						name: '张三',
						appellation: '先生',
						phone: '+852 22631356'
					},
					{
						id: 2,
						addr: '深圳大廈 912',
						name: '张三',
						appellation: '先生',
						phone: '+852 22631356'
					},
				],
				notAddrList: [{
						id: 1,
						addr: '深圳大廈 912',
						name: '张三',
						appellation: '先生',
						phone: '+852 22631356'
					},
					{
						id: 2,
						addr: '深圳大廈 912',
						name: '张三',
						appellation: '先生',
						phone: '+852 22631356'
					},
				]
			}
		},
		methods: {
			goSearch() {
				console.log('asdad')
				uni.navigateTo({
					url: '/pages/location/search'
				})
			}
		}
	}
</script>

<style>
	.header {
		background-color: #fff;
		padding: 8rpx 24rpx;
		display: flex;
		align-content: center;
		align-items: center;

		.region {
			width: 160rpx;
			text-align: center;
		}

		.search {
			width: calc(100% - 160rpx);
		}
	}

	.location {
		margin-top: 28rpx;
		padding: 32rpx;
		background-color: #fff;

		.label {
			color: #033787;
			font-size: 22rpx;
		}

		.con {
			margin-top: 16rpx;
			display: flex;
			justify-content: space-between;

			.addr {
				color: #0C1626;
				font-size: 30rpx;
				font-weight: 600;
			}

			.retry {
				display: flex;
				color: #7C8493;
				font-size: 26rpx;
			}
		}
	}

	.divider {
		margin: 48rpx 32rpx;
		color: #E35525;
		font-size: 30rpx;
	}

	.list {
		padding: 0 32rpx;
		background-color: #fff;

		.item:not(:first-child) {
			border-top: 1rpx solid #E6EAEE;
		}

		.item {
			height: 88rpx;
			display: flex;
			flex-direction: column;
			justify-content: space-around;
			padding: 24rpx 0;

			.name {
				font-size: 30rpx;
				color: #0C1626;
				font-weight: 600;
			}

			.info {
				font-size: 20rpx;
				color: #033787;
				display: flex;

				.text:not(:first-child) {
					margin-left: 24rpx;
				}
			}
		}
	}
</style>